package cn.edu.dzkd.software.controller;

import cn.edu.dzkd.software.pojo.Scan;
import cn.edu.dzkd.software.service.ScanService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Map;

@RestController
@RequestMapping("/scan")
public class ScanController {

    @Resource
    private ScanService scanService;

    @RequestMapping("/selectScans")
    public Map<String, Object> selectScans(@RequestParam int page,
                                           String componentName,
                                           String riskName,
                                           String bugName) {
        return scanService.selectScans(page, componentName, riskName, bugName);
    }

    @RequestMapping(value = "/insert", method = RequestMethod.POST)
    public Map<String, Object> insert(@RequestBody Scan scan) {
        return scanService.insert(scan);
    }

    @RequestMapping(value = "/update", method = RequestMethod.POST)
    public Map<String, Object> update(@RequestBody Scan scan) {
        return scanService.update(scan);
    }

    @RequestMapping(value = "/delete", method = RequestMethod.POST)
    public Map<String, Object> delete(@RequestParam Integer id) {
        return scanService.delete(id);
    }
}
